fix: check tree_win exists before closing#2904
fix: check tree_win exists before closing#2904kylebeede wants to merge 2 commits intonvim-tree:masterfrom
Conversation
alex-courtis
left a comment
There was a problem hiding this comment.
This codepath is very fragile and will be rewritten shortly #2255
There is a change in functionality: the current window (0) will not be closed when tree_win is not available/incorrect, which is it in many cases.
We are going to have to be defensive about this one, making no changes to existing codepaths.
Options:
- Check that this is not the last window: only one window open in only one tab.
- Make the call safely via a
pcall: log a DEBUG message and exit early.
1 may have side-effects, hence we should go with 2.
|
Many thanks for isolating this one; issues around there are often very difficult to replicate. |
Thanks @alex-courtis, I didn't realize this - sorry about that.
I can make this change unless you think it's best to wait for the re-write. I don't see a EDIT: took a crack at it in #2913 |
Description
Fixes
Vim:E444: Cannot close last windowerror when after running:NvimTreeCloseMinimal config
Steps to reproduce
nvim .:NvimTreeOpen:NvimTreeCloseCurrent behavior
nvim-tree closes with the following error: